<template>
	<view class="my">
		<!-- 背景图 -->
		<view class="current"></view>
		<view class="textName">
			个人中心
		</view>
		<view class="bjImage">
			<view class="k" style="display: flex;">
				<image :src="image + '/profile/avatar/2023/07/24/blob_20230724162306A008.png'" mode=""></image>
				<view class="" style="font-size: 38rpx;height: 120rpx;margin-left:30rpx;color: white;" v-if="user.nickName" >
					<view class="" style="height: 70rpx;line-height: 70rpx;">
						{{user.nickName||''}}
					</view>
					<view class="" style="height: 50rpx;line-height: 50rpx;font-size: 26rpx;">
						{{user.phonenumber||''}}
					</view>
				</view>
				<view class="name" style="font-size: 36rpx;" v-else  @tap.stop="Jump('/pages/login/login')">登录</view>
				<view class="name">
					<image src="@/static/my/code.png" class="code" mode="" @tap.stop="Jump('/pages/my/accountCard/accountCard')"></image>
				</view>
			</view>
		</view>
		<!-- 列表 -->
		<view class="listBox">
			<view class="list flex-r-b-c" >
				<view class="text">员工姓名</view>
				<view class="text">{{user.nickName|| ''}}</view>
			</view>
			<view class="list flex-r-b-c">
				<view class="text">员工电话</view>
				<view class="text">{{user.phonenumber|| ''}}</view>
			</view>
			<view class="list flex-r-b-c" >
				<view class="text">所在职位</view>
				<view class="text" v-if="user.posts">{{user.posts[0].postName|| ''}}</view>
			</view>
			<view class="list flex-r-b-c" v-if="user.userType == '03'">
				<view class="text">所属组长</view>
				<view class="text">{{user.leaderName|| ''}}</view>
				<!-- <u-icon name="arrow-right" size="32" color="#B6B6B6"></u-icon> -->
			</view>
		</view>
		<view class="popupBtn"  @tap.stop="editAccount">退出登录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				myData: {},
				userList:{},
				mobile:'',
				image: this.$base.smallimgUrl,
				isDisable:0,
				user: {},
				three1List:[
					{
						url:'/static/my/t1.png',
						title:'佣金',
						des:'1231',
						color:'#FD6C6C'
					},
					{
						url:'/static/my/t2.png',
						title:'会员等级',
						des:'Lv1',
						color:'#3DAD81'
					},
					{
						url:'/static/my/t3.png',
						title:'我的积分',
						des:'1231',
						color:'#8C7BFD'
					},
				],
			};
		},
		onShow() {
			this.getUserInfo()
			this.mobile = uni.getStorageSync('mobile')? uni.getStorageSync('mobile'):''
		},
		onLoad(){
			this.getUserInfo()
			console.log(uni.getStorageSync('token'),'token1')
		},
		methods: {
			editAccount(){
				uni.removeStorageSync('token')
				this.getUserInfo()
				console.log(uni.getStorageSync('token'),'token2')
			},
			// 点击跳转收益
			toProfit(){
				uni.navigateTo({
					url: '/pages/my/profit/profit'
				})
			},
			// 获取用户信息
			getUserInfo(){
				let that = this
				that.$api.getInfo().then(res => {
					this.user =res.data.user
				})
			},
				
			// 跳转
			Jump(url){
				if(url == '/pages/my/imagePage/imagePage?type=1'&& this.userList.memberLevel == 1){
					this.$utils.toast('会员等级不够，请先升级')
				}else{
					uni.navigateTo({
						url: url
					})
				}
			},
			
			// 获取手机号
			getPhoneNumber(e){
				let that = this
				that.$api.getMobile({
					...e.detail
				}).then(res => {
					this.mobile = res.data.data.mobile
					uni.setStorageSync('mobile',this.mobile)
					// that.getMyData()
				})
			},
			
			// 加入会员
			goMsember(){
				uni.navigateTo({
					url: '/pages/my/member/member'
				})
			}
			
		}
	}
</script>

<style lang="less">
	.popupBtn {
		width: 92%;
		height: 96rpx;
		line-height: 96rpx;
		border-radius: 16rpx;
		background-color: #469D96;
		color: #fff;
		font-size: 28rpx;
		font-weight: 500;
		text-align: center;
		position: absolute;
		bottom:5%;
		left: 4%;
	}
	.current {
		background: url();
		background-size: 100% 100%;
		height: 900px;
		background-repeat: no-repeat;
		position: fixed;
		top: -10px;
		overflow: hidden;
		left: 0;
		width: 100%;
	}
	.textName{
		top: 3%;
		left: 41%;
		position: fixed;
		color: #fff;
		font-size: 34rpx;
	}
	page{
		background-color: #f9f9f9;
	}
	button {
		margin: 0;
		padding: 0;
		border: none;
		background: none;
	}
	
	button::after {
		border: none;
	}
	.record{
		position: absolute;
		left: 9%;
		top: 42%;
		color: #fff;
		font-size: 22rpx;
		z-index: 1000;
	}
	.my{
		width: 100vw;
		
		.bjImage{
			width: 100%;
			image{
				width: 100%;
			}
			
			.k{
				width: 800rpx;
				height: 200rpx;
				display: flex;
				border: 1px soild black;
				position: absolute;
				top: 220rpx;
				left: 50rpx;
				overflow: hidden;
				// justify-content: space-between;
				.code{
					margin-left: 300rpx;
					margin-top: 40rpx;
					width: 30rpx;
					height: 30rpx;
					text-align: right;
					line-height: 64rpx;
				}
				// border-radius: 50%;
				image{
					width: 120rpx;
					height: 120rpx;
					border-radius: 50%;
				}
				.name{
					height: 120rpx;
					line-height: 120rpx;
					margin-left: 10rpx;
					color: #000;
				}
			}
			
		}
		
		.infoBox{
			width: 90%;
			height: 154rpx;
			position: fixed;
			top: 30%;
			border-radius: 20rpx;
			// background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, #FFFFFF 100%);
			background: #FFFFFF;
			backdrop-filter: blur(10px);
			margin: 0 auto;
			margin-top: -58rpx;
			padding: 10rpx 30rpx;
			
			.info_t{
				width: 100%;
				padding-bottom: 30rpx;
				border-bottom: 1px solid #EFEFEF;
				image{
					width: 120rpx;
					height: 120rpx;
					border-radius: 50%;
				}
				
				.info_t_r{
					width: 75%;
					font-size: 28rpx;
					font-weight: 400;
					color: #000;
					.info{
						width: 100%;
						.info_l{
							image{
								width: 42rpx;
								height: 42rpx;
								border-radius: 0;
							}
						}
					}
					.tel{
						margin-top: 20rpx;
					}
				}
				
			}
			
			
			.info_b{
				padding: 20rpx 40rpx;
				.three1{
					text-align: center;
					width: 140rpx;
					height: 140rpx;
				}
				.info_b_l{
					width: 50%;
					text-align: center;
					font-size: 24rpx;
					font-weight: 400;
					color: #474747;
					.money{
						font-size: 32rpx;
						font-weight: 500;
						color: #000;
						margin-top: 20rpx;
					}
				}
				.btn{
					width: 180rpx;
					height: 62rpx;
					line-height: 62rpx;
					background-color: #000;
					text-align: center;
					border-radius: 62rpx;
					color: #fff;
					font-size: 24rpx;
					font-weight: 400;
				}
			}
			
			
		}
		
		
		.member{
			width: 90%;
			height: 136rpx;
			border-radius: 20rpx;
			background-color: #fff;
			padding: 30rpx;
			margin: 0rpx auto 40rpx;
			.line{
				background: rgba(217, 217, 217, 0.4);
				height: 70rpx;
				line-height: 70rpx;
				width: 3rpx;
			}
			.member_l{
				font-size: 24rpx;
				font-weight: 400;
				color: #7F8084;
				text-align: center;
				margin: 0 auto;
				.title{
					font-size: 28rpx;
					font-weight: 500;
					color: #000;
					margin-bottom: 10rpx;
				}
				.text{
					color: #3DAD81;
				}
			}
			.member_r{
				width: 136rpx;
				height: 60rpx;
				line-height: 60rpx;
				text-align: center;
				background: #000;
				border-radius: 60rpx;
				font-size: 24rpx;
				font-weight: 400;
				color: #fff;
			}
		}
		
		.listBox{
			width: 100%;
			margin: 40rpx auto;
			// background: #fff;
			border-radius: 20rpx;
			padding: 30rpx;
			// display: flex;
			// flex-wrap: wrap;
			text-align: center;
			position: absolute;
			top:24%;
			.list{
				width: 100%;
				background: #fff;
				text-align: center;
				margin: 30rpx auto;
				border-radius: 18rpx;
				padding: 10rpx 30rpx;
				height: 100rpx;
				line-height: 100rpx;
				// border: 1px solid gray;
				.list_l{
					text-align: center;
					margin: 10rpx 0;
					image{
						width: 40rpx;
						height: 40rpx;
						margin-bottom: 10rpx;
					}
					.text{
						font-size: 28rpx;
						font-weight: 400;
						margin-bottom: 10rpx;
					}
				}
			}
		}
		
	}
</style>
